spinbutton: Set the correct state on the button contexts
authorBenjamin Otte <otte@redhat.com>
Thu, 16 Oct 2014 15:00:20 +0000 (17:00 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 16 Oct 2014 15:18:34 +0000 (17:18 +0200)
With the recent save-is-child changes, using
  gtk_style_context_get_padding (context, different_state)
will now open a subelement.

This is not what we want, so we check the state whenever we get the
button contexts.

gtk/gtkspinbutton.c

index 770f242adbb93857f7e00288ef0a0df876d4e6be..b191784e488fb2a1254a3e75c77171de202cfa36 100644 (file)
@@ -922,9 +922,13 @@ gtk_spin_button_panel_get_context (GtkSpinButton *spin_button,
                                                  panel == priv->down_panel);
     }
 
+  gtk_style_context_set_state (*contextp, gtk_spin_button_panel_get_state (spin_button, panel));
+
   return *contextp;
 }
 
+#include "gtkcsssectionprivate.h"
+
 static void
 gtk_spin_button_panel_get_size (GtkSpinButton *spin_button,
                                 GdkWindow *panel,
@@ -940,7 +944,7 @@ gtk_spin_button_panel_get_size (GtkSpinButton *spin_button,
   icon_size = MAX (w, h);
 
   context = gtk_spin_button_panel_get_context (spin_button, panel);
-  state = gtk_spin_button_panel_get_state (spin_button, panel);
+  state = gtk_style_context_get_state (context);
 
   gtk_style_context_get_padding (context, state, &button_padding);
   gtk_style_context_get_border (context, state, &button_border);
@@ -1031,7 +1035,6 @@ gtk_spin_button_panel_draw (GtkSpinButton   *spin_button,
 {
   GtkSpinButtonPrivate *priv = spin_button->priv;
   GtkStyleContext *context;
-  GtkStateFlags state;
   GtkWidget *widget;
   gdouble width, height, x, y;
   gint icon_width, icon_height;
@@ -1043,8 +1046,6 @@ gtk_spin_button_panel_draw (GtkSpinButton   *spin_button,
   gtk_cairo_transform_to_window (cr, widget, panel);
 
   context = gtk_spin_button_panel_get_context (spin_button, panel);
-  state = gtk_spin_button_panel_get_state (spin_button, panel);
-  gtk_style_context_set_state (context, state);
 
   height = gdk_window_get_height (panel);
   width = gdk_window_get_width (panel);